'
' StoreNuke.Net -  http:'www.storenuke.net
' Copyright (c) 2005
' by Robert J Collins ( info@storenuke.net ) of WillowTree Software, Inc. ( http:'www.willowtreesoftware.com )
'
' Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 
' documentation files (the "Software"), to deal in the Software without restriction, including without limitation 
' the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and 
' to permit persons to whom the Software is furnished to do so, subject to the following conditions:
'
' The above copyright notice and this permission notice shall be included in all copies or substantial portions 
' of the Software.
'
' THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 
' TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 
' THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 
' CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
' DEALINGS IN THE SOFTWARE.
'

Imports System.Web
Imports System.Data.SqlClient
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports StoreNuke.StarterKit.Commerce
Imports StoreNuke.StarterKit.Commerce.Components


    Public MustInherit Class PayPalCheckOutAdmin
    Inherits UserControl

    Protected WithEvents Label2 As Label
    Protected WithEvents txtPayPalID As TextBox
    Protected WithEvents Label3 As Label
    Protected WithEvents txtPayPalCartName As TextBox
    Protected WithEvents Label6 As Label
    Protected WithEvents txtPayPalButtonURL As TextBox
    Protected WithEvents Label8 As Label
    Protected WithEvents txtPayPalCurrency As TextBox
    Protected WithEvents btnSubmit As LinkButton
    Protected WithEvents lblError As Label
    Protected WithEvents pnAdmin As Panel
    Protected WithEvents btnShowAdmin As LinkButton
    Dim store As New StoreControlsDB

#Region " Web Form Designer Generated Code "

        'This call is required by the Web Form Designer.
        <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub

        Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
            'CODEGEN: This method call is required by the Web Form Designer
            'Do not modify it using the code editor.
            InitializeComponent()
        End Sub

#End Region

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Load
    End Sub

    Private Sub GetPayPalConfigurations()
        Dim settings As Hashtable = store.GetStoreControlSettings(5)
        If (settings("WTPayPalID") <> Nothing) Then
            txtPayPalButtonURL.Text = settings("WTPayPalImageURL").ToString()
            txtPayPalID.Text = settings("WTPayPalID").ToString()
            txtPayPalCartName.Text = settings("WTPayPallCartName").ToString()
            txtPayPalCurrency.Text = settings("WTPayPalCurrency").ToString()
        End If
    End Sub

    Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
        store.AddUpateStoreControlSettings(5, "WTPayPalImageURL", txtPayPalButtonURL.Text)
        store.AddUpateStoreControlSettings(5, "WTPayPalID", txtPayPalID.Text)
        store.AddUpateStoreControlSettings(5, "WTPayPallCartName", txtPayPalCartName.Text)
        store.AddUpateStoreControlSettings(5, "WTPayPalCurrency", txtPayPalCurrency.Text)
    End Sub

    Private Sub btnShowAdmin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnShowAdmin.Click
        If (pnAdmin.Visible) Then
            btnShowAdmin.Text = "Open Gateway Admin"
            pnAdmin.Visible = False
        Else
            btnShowAdmin.Text = "Close Gateway Admin"
            pnAdmin.Visible = True
            GetPayPalConfigurations()
        End If
    End Sub
End Class
